using System.Runtime.Serialization.Formatters;

public class DeathBringerTeleportState : EnemyState
{
    private new DeathBringer Enemy => (DeathBringer)base.Enemy;

    public DeathBringerTeleportState(Enemy enemy, string animName) : base(enemy, animName) { }

    public override void Enter()
    {
        base.Enter();
        Enemy.Stats.MakeInvincible(true);
    }

    public override void Update()
    {
        base.Update();
        if (TriggerCalled)
        {
            if (Enemy.CanDoSpellCast())
            {
                StateMachine.ChangeTo(Enemy.SpellCast);
            }
            else
            {
                StateMachine.ChangeTo(Enemy.Battle);
            }
        }
    }

    public override void Exit()
    {
        base.Exit();
        Enemy.Stats.MakeInvincible(false);
    }
}
